<template>
  <div o-Container>
    <div class="content_left_box">
      <div class="top_box">
        <div class="search_box">
          <img src="/static/skin/herodoo/main/platform/home/img/search.png" alt="">
          <input v-model="searchValue" type="text" placeholder="请输入搜索内容" @keydown.enter="searchEnterKeyPress"
            @blur="searchEnterKeyPress">
          <!-- <img src="/static/skin/herodoo/main/platform/home/img/shaixuan.png" alt="" @click="openScreen()"> -->
        </div>
        <!-- <div class="button_box">
          <button>导出订单</button>
        </div> -->
      </div>
    </div>
    <o-list v-bind:source="list.contract" v-bind="{ exported: output}">
      <template slot="config" slot-scope="scope">
        <div class="img_box">
          <img @click="showLookDiaolog(scope, '1')" src="/static/skin/default/MCS/AIGC/Inventory/images/chakan.png"
            alt="">
          <!-- <img v-if="scope.data.row.Status == '已驳回'" @click="showLookDiaolog(scope, '2')" src="/static/skin/default/MCS/AIGC/Inventory/images/bianji.png"
            alt=""> -->
          <!-- <img @click="showLookDiaolog(scope, '3')" src="/static/skin/default/MCS/AIGC/Inventory/images/shanchu.png"
            alt=""> -->
        </div>
      </template>
    </o-list>
    <!-- 查看权益详情 -->
    <SalesOrderMsg ref="SalesOrderMsg" :messageList="messageList"></SalesOrderMsg>
    <!-- 退款申请 -->
    <RefundApply ref="refundApply" :messageList="messageList" @reload="reload"></RefundApply>
    <screenRights ref="screenRights" @searchFun="search"></screenRights>
  </div>
</template>

<script>
import SalesOrderMsg from '../Components/SalesOrderMsg.vue'
import RefundApply from "../Components/refundApply.vue";
import screenRights from "../Components/screenRights.vue"
export default {
  components: {
    RefundApply,
    SalesOrderMsg,
    screenRights
  },
  name: "mms_platform_company_list", /* 这个name暂时不知道用啥用，根据官方文档说的是方便排错的 */
  data() {
    return {
      octopus: this.$parent.octopus,
      list: {
        contract: {
          data: {
            id: 1256, // 菜单表的八爪鱼ID
            cellData: [
              { name: "Code", width: 200 ,filterKey: 'like', filterValue:''},	// 交易订单
              { name: "Name", width: 400 },	// 交易订单
              // { name: "EquityName", width: 350 },	// 权益名称
              { name: "RefundReasons", width: 300 },	// 退款原因
              { name: "Status" },	// 售后状态
              { name: "RefundQuantity" },	// 退款数量
              { name: "RefundAmount" },	// 退款金额
              { name: "ServiceCharge" },	// 手续费（元）
              { name: "Quantity" },	// 购买数量
              { name: "RefundPlatformID" },	// 退款渠道
              { name: "PurchaseTime", width: 150 },	// 下单时间
              { name: "ID",show: false },	// ID
              { name: "CompanyID", show: false },	// 卖家
              { name: "EquityID", show: false },	// 权益ID
              { name: "IsRefundAudit", show: false },	// 退款是否需要审核（0不需要 1需要）
              { name: "OutRefundCode", show: false },	// 退款编号
              { name: "ProductFlagList", show: false },	// 产品标签
              { name: "ProductFlagListName", show: false },	// 产品标签
              { name: "ProductID", show: false },	// 产品ID
              { name: "ProductName", show: false },	// 产品名称
              { name: "PurchaseContact", show: false },	// 订单联系人
              { name: "PurchaseMobile", show: false },	// 订单联系手机号
              { name: "PurchaseName", show: false },	// 买家
              { name: "PurchasePlatformID", show: false },	// 购买渠道
              { name: "PurchaseRemarks", show: false },	// 订单备注
              { name: "RefundTime", show: false },	// 申请退货时间
              { name: "ServiceCompany", show: false },	// 服务方
              { name: "StatusID", show: false },	// 状态ID
              { name: "TradeCode", show: false },	// 交易订单
              { name: "updateTime", show: false },	// 最后修改时间
              { name: "UserPayTotalPrice", show: false },	// 购买金额（元）
              
              { name: "OrderTime", show: false },	//下单时间
              { name: "RefundChannel", show: false },	//退款渠道
              {name: "ExpireTime", show: false},	// 权益结束时间
              {name: "CostPrice", show: false},	// 平台价格
              {name: "MerchantID", show: false},	// 买家
              {name: "CompanyID", show: false},	// CompanyID
              {name: "PlatformID", show: false},	// PlatformID
              {name: "PurchaseID", show: false},	// PurchaseID
            ],
            paramData: {
              // CompanyID: this.octopus.passport.id
            }
          },
          configWidth: 35,
          showNumber: true,
        },
      },
      repetition: true,
      messageList: {},
      messageListAdd: {},
      orderType: 1,
    }
  },
  created() {
    this.init();
  },
  methods: {
    init() {
      const data = this.list.contract.data
      let company = this.octopus.passport.authorization.company
      // data.paramData.CompanyID = company == 1 ? 'NULL' : company
      data.paramData.CompanyID = company
      data.paramData.CreateUserID = this.octopus.passport.id
    },
    showLookDiaolog(row, type = 1) {
      this.orderType = type
      this.messageList = row.data.row;
      this.$nextTick(() => {
        if (type == 1) {
          this.$refs.SalesOrderMsg.drawerOp()
          this.$refs.SalesOrderMsg.pageShow = 2;
        }
        if (type == 2) {
          this.$refs.refundApply.drawerOp(this.messageList.PurchaseID)
        }
      })


    },
    output: function (data) {
      this.octopus.tips.success("下载完成。");
    },
    search: function (cell) {
    },
    save: function (data) {// 保存
      this.octopus.tips.success(data);
      // 刷新list
      this.list.contract.control.load();
      this.back();
    },
    back: function () {
      this.panel.visible = false;
    },
    refresh() {
      const data = this.list.contract.data
      let company = this.octopus.passport.authorization.company
      data.paramData.CompanyID = company == 1 ? 'NULL' : company
      this.list.contract.control.load();
    },
    openScreen() {
      this.$refs.screenRights.drawerOp();
    },
    searchEnterKeyPress(e) {
      this.list.contract.data.cellData[0].filterValue = this.searchValue
      this.list.contract.control.load()
    },
    reload(){
      this.list.contract.control.load();
    }
  },
  props: ["oData"]
}
</script>
<style scoped>
@import url("../../../../../../static/skin/default/MMS/AIGC/css/base.css");

.el-message-box {
  background-color: #fff !important;
}

.img_box {
  display: flex;
  justify-content: space-between;
  width: 100%;
}

.img_box img {
  width: 25px;
  cursor: pointer;
}
>>> .Operation {
  position: absolute;
  top: 1.5rem;
  left: 36rem;
}
>>> .Content {
  height: 84vh!important;
}
</style>